From 6f5f3c1f18a3597df04f831d4a8e1cdba2c0ecea Mon Sep 17 00:00:00 2001 From: Sebastian Keller Date: Fri, 13 Mar 2026 01:27:29 +0100 Subject: [PATCH] systemActions: Fix initial visibility of logout action When `_updateLogout()` is called on login, the AccountsService user might not have been loaded yet. This would have resulted in all values being null/false, including `local_account`. Since `!localAccount` is one of the cases where the action is available, this would have wrongly resulted in the item being shown when not intended to be shown. But only until something triggers another call of `_updateLogout()`, such as locking/unlocking the session. Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/9100 Part-of: --- js/misc/systemActions.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/js/misc/systemActions.js b/js/misc/systemActions.js index db559bfc2..75bada6a1 100644 --- a/js/misc/systemActions.js +++ b/js/misc/systemActions.js @@ -176,6 +176,10 @@ const SystemActions = GObject.registerClass({ this._userManager.connect('user-removed', () => this._updateMultiUser()); + this._user = this._userManager.get_user(GLib.get_user_name()); + + this._user.connect('notify::is-loaded', () => this._updateLogout()); + this._lockdownSettings.connect(`changed::${DISABLE_USER_SWITCH_KEY}`, () => this._updateSwitchUser()); this._lockdownSettings.connect(`changed::${DISABLE_LOG_OUT_KEY}`, @@ -434,12 +438,9 @@ const SystemActions = GObject.registerClass({ } _updateLogout() { - const user = this._userManager.get_user(GLib.get_user_name()); - const allowLogout = !this._lockdownSettings.get_boolean(DISABLE_LOG_OUT_KEY); const alwaysShow = global.settings.get_boolean(ALWAYS_SHOW_LOG_OUT_KEY); - const systemAccount = user.system_account; - const localAccount = user.local_account; + const {systemAccount, localAccount} = this._user; const multiUser = this._userManager.has_multiple_users; const multiSession = Gdm.get_session_ids().length > 1; const shouldShowInMode = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter; -- 2.39.5